from langchain_core.prompts import ChatPromptTemplate


write_step1_template_d_EN = ChatPromptTemplate.from_template(
"""
# Role
You are an introduction writing assistant for a literature review.

# Background
- The user has a request to write a research review, which is a review of the research context of a technical method. You are responsible for writing the introduction section of this review.
- The structure of the review should be Introduction -> Basic Principles -> Historical Achievements -> Current Research -> Challenges and Future Directions -> Summary and Conclusion.
- You are only responsible for the introduction section, so do not write summary statements. Write in complete paragraphs, do not write one sentence per paragraph, and avoid bullet points!

# Introduction Writing Requirements
- First, introduce the background, importance, and research motivation of the concept, explaining its position in the technical or academic field. In this part, you need to cite 30 papers. The user will provide you with 15 paper excerpts on the research background of this concept and 15 paper excerpts on its position in the technical or academic field. You need to select the papers that are most relevant to the topic.
- Then, describe the overall approach and structure of the review to set the stage for the main content.
- When citing papers, summarize and logically infer the content, and do not directly use the original text. Also, pay attention to the logical coherence between the sentences.

# User's Request
- {user_input}

# Research Background Related Paper Excerpts
- {background_paper}

# Status of the Concept in the Technical or Academic Field Paper Excerpts
- {importance_paper}

# Output Format
- Output the introduction of the literature review in markdown format.
- If you have cited a paper, you need to append a specific formatted string <sup>paper_title***chunk_id***year</sup> after the cited statement to indicate the reference. Here, “paper_title” should correspond to the 'paper_title' value from the paper fragment I provided, and “chunk_id” should correspond to the 'chunk_id' value from the paper fragment I provided, and “year” should correspond to the 'year' value from the paper fragment I provided.
- Start with '## Introduction' and do not output any additional content!
- Note! You are responsible for the introduction part, so do not write summary statements like "In conclusion."

Example:
## Introduction
Machine learning is a type of computer algorithm program<sup>Octavius: Mitigating Task Interference in MLLMs Via LoRA-MoE***1***2024</sup>, and its emergence began in the 1940s<sup>MM1: Methods, Analysis Insights from Multimodal LLM Pre-training***0***2024</sup>

Start the task!
"""
)


write_step2_template_d_EN = ChatPromptTemplate.from_template(
"""
# Role
- You are a literature review continuation assistant.

# Background
- The user has a requirement to write a research review, which is a review of the research context of a specific technological method, and you are responsible for writing the "Fundamentals" section of this review.
- The structure of this review should be: Introduction -> Fundamentals -> Historical Achievements -> Current Research Status -> Challenges and Future Directions -> Summary and Conclusion.
- You are only responsible for continuing the "Fundamentals" section, so avoid writing conclusive statements. Write it in several complete paragraphs, not one sentence per paragraph, and do not list items!

# Fundamentals Writing Requirements
- You need to detail the core concepts of this topic and break down the explanation of each component's definition.
- Note! In this section, you need to reference 20 papers. The user will provide you with 20 paper excerpts related to the foundational definitions of this concept, and you should choose the ones that are most relevant to the topic.
- When citing papers, summarize and reason through the content, do not directly use the original text, and ensure logical coherence.
- Note! You are only responsible for the "Fundamentals" section, so do not write summary phrases like "In conclusion," etc.

# User's Request
- {user_input}

# Already Written Introduction Section
- {step1_d}

# Paper Excerpts Related to the Basic Definitions
- {definition_paper}

# Output Format
- Output a markdown format of the literature review.
- If you have cited a paper, you need to append a specific formatted string <sup>paper_title***chunk_id***year</sup> after the cited statement to indicate the reference. Here, “paper_title” should correspond to the 'paper_title' value from the paper fragment I provided, and “chunk_id” should correspond to the 'chunk_id' value from the paper fragment I provided, and “year” should correspond to the 'year' value from the paper fragment I provided.
- When outputting, only output the content of this section, starting with '## Fundamentals,' and do not include extra content!
- Note! You cannot write summary statements like "In conclusion," as this will disrupt the overall structure of the article!

Example:
## Fundamentals
Machine learning is a type of computer algorithm program<sup>Octavius: Mitigating Task Interference in MLLMs Via LoRA-MoE***1***2024</sup>, and its emergence began in the 1940s<sup>MM1: Methods, Analysis Insights from Multimodal LLM Pre-training***0***2024</sup>

Start the task!
"""
)


write_step3_template_d_EN = ChatPromptTemplate.from_template(
"""
# Role
- You are a literature review continuation assistant.

# Background
- The user has a requirement to write a research review, which is a review of the research context of a specific technological method, and you are responsible for writing the "Historical Achievements" section of this review.
- The structure of this review should be: Introduction -> Fundamentals -> Historical Achievements -> Current Research Status -> Challenges and Future Directions -> Summary and Conclusion.
- You are only responsible for continuing the "Historical Achievements" section, so avoid writing conclusive statements. Write it in several complete paragraphs, not one sentence per paragraph, and do not list items!

# Historical Achievements Writing Requirements
- First, cite literature to introduce the development history of this technology in chronological order and describe important historical works.
- Note! In this section, you need to reference 20 papers. The user will provide you with 20 paper excerpts related to the historical works of this technology, and you should choose the ones that are most relevant to the topic.
- When citing papers, summarize and reason through the content, do not directly use the original text, and ensure logical coherence.

# User's Request
- {user_input}

# Paper Excerpts Related to Historical Works
- {present_work_paper}

# Output Format
- Output a markdown format of the literature review.
- If you have cited a paper, you need to append a specific formatted string <sup>paper_title***chunk_id***year</sup> after the cited statement to indicate the reference. Here, “paper_title” should correspond to the 'paper_title' value from the paper fragment I provided, and “chunk_id” should correspond to the 'chunk_id' value from the paper fragment I provided, and “year” should correspond to the 'year' value from the paper fragment I provided.
- When outputting, only output the content of this section, starting with '## Historical Achievements,' and do not include extra content!
- Note! You cannot write summary statements like "In conclusion," as this will disrupt the overall structure of the article!

Example:
## Historical Achievements
Machine learning is a type of computer algorithm program<sup>Octavius: Mitigating Task Interference in MLLMs Via LoRA-MoE***1***2024</sup>, and its emergence began in the 1940s<sup>MM1: Methods, Analysis Insights from Multimodal LLM Pre-training***0***2024</sup>

Start the task!
"""
)


write_step4_template_d_EN = ChatPromptTemplate.from_template(
"""
# Role
- You are a literature review continuation assistant.

# Background
- The user has a requirement to write a research review, which is a review of the research context of a specific technological method, and you are responsible for writing the "Current Research Status" section of this review.
- The structure of this review should be: Introduction -> Fundamentals -> Historical Achievements -> Current Research Status -> Challenges and Future Directions -> Summary and Conclusion.
- You are only responsible for continuing the "Current Research Status" section, so avoid writing conclusive statements. Write it in several complete paragraphs, not one sentence per paragraph, and do not list items!

# Current Research Status Writing Requirements
- Cite papers to provide a detailed introduction to the current research status of this topic, explaining the characteristics of different methods, technologies, and algorithms in separate modules.
- Note! In this section, you need to reference 20 papers. The user will provide you with 20 paper excerpts related to the current research status of this technology, and you need to choose the most relevant papers for the topic.
- When citing papers, summarize and reason through the content, do not directly use the original text, and ensure logical coherence.

# User's Request
- {user_input}

# Paper Excerpts Related to Current Research Status
- {related_work_paper}

# Output Format
- Output a markdown format of the literature review.
- If you have cited a paper, you need to append a specific formatted string <sup>paper_title***chunk_id***year</sup> after the cited statement to indicate the reference. Here, “paper_title” should correspond to the 'paper_title' value from the paper fragment I provided, and “chunk_id” should correspond to the 'chunk_id' value from the paper fragment I provided, and “year” should correspond to the 'year' value from the paper fragment I provided.
- When outputting, only output the content of this section, starting with '## Current Research Status,' and do not include extra content!
- Note! You cannot write summary statements like "In conclusion," as this will disrupt the overall structure of the article!

Example:
## Current Research Status
Machine learning is a type of computer algorithm program<sup>Octavius: Mitigating Task Interference in MLLMs Via LoRA-MoE***1***2024</sup>, and its emergence began in the 1940s<sup>MM1: Methods, Analysis Insights from Multimodal LLM Pre-training***0***2024</sup>

Start the task!
"""
)


write_step5_template_d_EN = ChatPromptTemplate.from_template(
"""
# Role
- You are a literature review continuation assistant.

# Background
- The user has a requirement to write a research review, which is a review of the research context of a specific technological method, and you are responsible for writing the "Challenges and Future Directions" section of this review.
- The structure of this review should be: Introduction -> Fundamentals -> Historical Achievements -> Current Research Status -> Challenges and Future Directions -> Summary and Conclusion.
- You are only responsible for continuing the "Challenges and Future Directions" section, so avoid writing conclusive statements. Write it in several complete paragraphs, not one sentence per paragraph, and do not list items!

# Challenges and Future Directions Writing Requirements
- Discuss the main challenges and issues currently faced by the technology.
- Based on existing trends, propose predictions for the future development of this field.
- Note! In this section, you need to reference 30 papers. The user will provide you with 15 paper excerpts related to the challenges of this technology and 15 related to the future development of this technology. You need to select the papers most relevant to the topic.
- When citing papers, summarize and reason through the content, do not directly use the original text, and ensure logical coherence.

# User's Request
- {user_input}

# Paper Excerpts on Challenges
- {challenge_paper}

# Paper Excerpts on Future Directions
- {future_work_paper}

# Output Format
- Output a markdown format of the literature review.
- If you have cited a paper, you need to append a specific formatted string <sup>paper_title***chunk_id***year</sup> after the cited statement to indicate the reference. Here, “paper_title” should correspond to the 'paper_title' value from the paper fragment I provided, and “chunk_id” should correspond to the 'chunk_id' value from the paper fragment I provided, and “year” should correspond to the 'year' value from the paper fragment I provided.
- When outputting, only output the content of this section, starting with '## Challenges and Future Directions'.
- Note! You cannot write summary statements like "In conclusion," as this will disrupt the overall structure of the article!

Example:
## Challenges and Future Directions
Machine learning is a type of computer algorithm program<sup>Octavius: Mitigating Task Interference in MLLMs Via LoRA-MoE***1***2024</sup>, and its emergence began in the 1940s<sup>MM1: Methods, Analysis Insights from Multimodal LLM Pre-training***0***2024</sup>

Start the task!
"""
)




write_step6_template_d_EN = ChatPromptTemplate.from_template(
"""
# Role
- You are a literature review continuation assistant.

# Background
- The user has a requirement to write a research review, which is a review of the research context of a specific technological method, and you are responsible for writing the "Summary and Conclusion" section of this review.
- The structure of this review should be: Introduction -> Fundamentals -> Historical Achievements -> Current Research Status -> Challenges and Future Directions -> Summary and Conclusion.
- You are only responsible for continuing the "Summary and Conclusion" section, so write it in complete paragraphs, without breaking it into single-sentence paragraphs or using bullet points!

# Summary and Conclusion Writing Requirements
- Use one paragraph to review and summarize the key points discussed in the review.

# User's Request
- {user_input}

# Already Written Review Sections
- {finished_work}

# Output Format
- Output a markdown format of the literature review summary.
- When outputting, you only need to provide the content for this section, starting with '## Summary and Conclusion'.

Start the task!
"""
)

check_template = ChatPromptTemplate.from_template(
"""
# 角色
- 你是一个文献综述内容检查助手

# 背景
- 用户有一个需求,需要编写一份调研综述,你负责检查这份综述的{aim}部分
- 你收到的是一篇还没有写完的综述
- 这篇综述的结构应该是引言->基本原理与发展历程->关键技术和衍生技术->实际应用举例->挑战与未来发展方向->总结与结论


# 检查要求
- 你需要检查这份综述的{aim}部分,以及之前的模块是否完整,例如当你在检查关键技术和衍生技术这个模块的时候发现文章缺少了引言模块,那么这篇文章就不符合要求了
- 你需要检查正文中的引用文献编号是否是连续的
- 你需要检查文章最后的[参考文献列表]是否缺失,并且内容是否符合格式要求
- 在正文中,如果你用了某篇论文,那么需要在引用相关的语句后面用一个特定格式的字符串<sup>标号</sup>来表示,标号是一个整数数字,一篇综述的标号从1开始依次递增,你需要进行检查
- [参考文献列表]的格式是'citation_id': xxx, 'paper_id':xxx, 'paper_title':xxx, 'chunk_id': xxx
- [参考文献列表]的格式示例：
[参考文献列表]
'citation_id': 1, 'paper_id':'6516338d3fda6d7f065e50d0', 'paper_title':'Resisting Backdoor Attacks in Federated Learning Via Bidirectional Elections and Individual Perspective', 'chunk_id': 6
'citation_id': 2, 'paper_id':'655d674d939a5f4082e02457', 'paper_title':'MultiDelete for Multimodal Machine Unlearning', 'chunk_id': 5
- 允许重复引用文献,你只需要检查引用编号是否连续,引用内容不需要检查.允许[参考文献列表]中的citation_id引用相同的paper_id,你不需要检查重复引用!

# 综述原文
- {article}

# 输出格式
输出一个字符串,该字符串的第一个字符只能是"0"或"1"
"0"表示这篇文章通过了检查
"1"标示值这篇综述没有通过检查
其他字符解释为啥没有通过检查,给出思考过程
不要输出多余的内容!
开始任务!
"""
)

